Skip to content

Conversation

ezhang6811
Copy link
Contributor

@ezhang6811 ezhang6811 commented Sep 24, 2025

Issue #, if available:

Description of changes:
Add a workflow nightly-build.yml with following actions:

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@ezhang6811 ezhang6811 requested a review from a team as a code owner September 24, 2025 01:54
Comment on lines +13 to +70
runs-on: ubuntu-latest
outputs:
has_changes: ${{ steps.check_changes.outputs.has_changes }}

steps:
- name: Checkout repository
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 #v5.0.0
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}

- name: Check if nightly branch already exists
run: |
if git ls-remote --exit-code --heads origin "$BRANCH_NAME"; then
echo "Branch $BRANCH_NAME already exists. Skipping run to avoid conflicts."
echo "Please merge or close the existing PR before the next nightly run."
exit 1
fi

- name: Configure git and create branch
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git checkout -b "$BRANCH_NAME"

- name: Set up Python
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c #v6.0.0
with:
python-version: '3.11'

- name: Install Python dependencies
run: pip install requests

- name: Update dependencies
run: python3 scripts/update_dependencies.py

- name: Check for changes and create PR
id: check_changes
run: |
if git diff --quiet; then
echo "No dependency updates needed"
echo "has_changes=false" >> $GITHUB_OUTPUT
else
echo "Dependencies were updated"
echo "has_changes=true" >> $GITHUB_OUTPUT

git add src/AWS.Distro.OpenTelemetry.AutoInstrumentation/AWS.Distro.OpenTelemetry.AutoInstrumentation.csproj build/Build.cs
git commit -m "chore: update OpenTelemetry dependencies to latest versions"
git push origin "$BRANCH_NAME"

gh pr create \
--title "Nightly dependency update: OpenTelemetry packages to latest versions" \
--body "Automated update of OpenTelemetry dependencies to their latest available versions." \
--base main \
--head "$BRANCH_NAME"
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
@ezhang6811 ezhang6811 added the skip changelog doesn't need a CHANGELOG entry label Sep 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip changelog doesn't need a CHANGELOG entry

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant